package com.situ.controller;


import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.situ.entity.*;
import com.situ.service.*;
import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator;
import com.sun.javafx.collections.MappingChange;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;

import javax.servlet.http.HttpSession;
import javax.xml.bind.SchemaOutputResolver;
import java.beans.PropertyEditor;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * BeOrder的路由接口服务
 * 
 * @author 胡文
 *
 */
@Controller
public class BeOrderController  {

	/** BeOrderService服务 */
	@Autowired
	private BeOrderService beOrderService;
	@Autowired
	private BeOrderuserService beOrderuserService;
	@Autowired
	private BeHistoryService beHistoryService;
	@Autowired
    private BeCommentService beCommentService;
	@Autowired
    private BeFormulaService beFormulaService;

	/**
	 * 查询所有BeOrder数据的方法
	 * @param
	 * @return
	 */
	@RequestMapping("show")
	public String show(){
		return "be__request.html";
	}
	@RequestMapping("a1")
	public String a1(){


		return "be__request1.html";
	}
	@RequestMapping("a2")
	public String a2(){
		return "be__request2.html";
	}
	@RequestMapping("a3")
	public String a3(){
		return "be__request3.html";
	}
	@RequestMapping("a4")
	public String a4(){
		return "be__request4.html";
	}
	@RequestMapping("a5")
	public String a5(){
		return "be__request5.html";
	}
	@RequestMapping("a6")
	public String a6(){
		return "be__request6.html";
	}
	@RequestMapping("a7")
	public String a7(){
		return "be__request7.html";
	}

	@RequestMapping("deal1")
	public String ao1(){
		return "be__auditForm.html";
	}

	@InitBinder  //
	public void dateconvert(WebDataBinder bind){
		DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		PropertyEditor n=new CustomDateEditor(format, true);
		bind.registerCustomEditor(Date.class, n);
	}

	//初步审核
	@RequestMapping(value = "queryBeOrder", produces = {"application/json;charset=UTF-8"})
	public String find(BeOrder value, @RequestParam(defaultValue ="1",required = false) int startPage ,
					   @RequestParam(defaultValue = "5",required = false) int PageSize,Map map) {
		PageHelper.startPage(startPage, PageSize);
		List<Map> list= beOrderService.selectStep();
		PageInfo pageInfo = new PageInfo<Map>(list,5);
		map.put("pageInfo", pageInfo);
		map.put("startPage", startPage);
		map.put("PageSize", PageSize);
         map.put("list",list);
         return "be__audit.html";
	}

	/**
	 * 通过id查询BeOrder数据的方法
	 * 
	 * @return
	 */

	//初步审核的处理
	@RequestMapping(value = "queryBeOrderById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findOne(@PathVariable(name="id") String id,Map map,HttpSession session) {
		BeOrder obj=  beOrderService.findOne(id);
		String orno=obj.getOrderNo();
		map.put("BeOrder", obj);
		session.setAttribute("orderno", orno);
		map.put("orderno",orno);
		return "be__auditForm.html";
	}


	@RequestMapping(value = "deal2", produces = {"application/json;charset=UTF-8"})
	public String deal(BeOrder value, BeHistory beHistory,Map map,HttpSession session) {
		value.setStepID(2);
		beOrderService.updateNotNullById(value);
		String orno= (String) session.getAttribute("orderno");
		System.out.println(orno);
		beHistory.setOrderNo(orno);

		beHistory.setStepID(3);
		Date d=new Date();
		beHistory.setDatee(d.toInstant());
		beHistoryService.saveNotNull(beHistory);

		return "redirect:/queryBeOrderfei";
	}
	//交施工费fei的查询页面
	@RequestMapping(value = "queryBeOrderfei", produces = {"application/json;charset=UTF-8"})
	public String findfei(BeOrder value, @RequestParam(defaultValue ="1",required = false) int startPage ,
					   @RequestParam(defaultValue = "5",required = false) int PageSize,Map map) {
		this.find(value, startPage, PageSize, map);
		return "be__pay.html";
	}

	//交施工费的单个处理查看
	@RequestMapping(value = "querybeuserById/{value}", produces = {"application/json;charset=UTF-8"})
	public String feilook(@PathVariable(name="value")String value,HttpSession session,Map map){
		List<BeOrderuser> list=beOrderService.beuser(value);
		String orderno=list.get(0).getOrderNo();
		map.put("list", list);
		session.setAttribute("list", list);
		session.setAttribute("orderno", orderno);
		return "be__payForm.html";
	}
	//交施工费的处理
	@RequestMapping(value = "feideal", produces = {"application/json;charset=UTF-8"})
	public String feideal(BeOrder value, BeHistory beHistory,BeOrderuser beuser,Map map,HttpSession session){
			value.setStepID(4);
			beHistory.setStepID(4);
		String orno= (String) session.getAttribute("orderno");
		System.out.println(orno);
		beHistory.setOrderNo(orno);
		Date d=new Date();
		beHistory.setDatee(d.toInstant());
		beHistory.setEmpID(3);
			beOrderService.updateNotNullById(value);
			beHistoryService.saveNotNull(beHistory);
		List<BeOrderuser> list = (List<BeOrderuser>) session.getAttribute("list");
		for(BeOrderuser b:list){
			beOrderuserService.updateNotNullById(beuser);
		}

		System.out.println(value+" "+beHistory+" "+beuser);
		return "redirect:/queryBeOrdershui";
	}

	//水费清算的查询页面
	@RequestMapping(value = "queryBeOrdershui", produces = {"application/json;charset=UTF-8"})
	public String findshui(BeOrder value, @RequestParam(defaultValue ="1",required = false) int startPage ,
						  @RequestParam(defaultValue = "5",required = false) int PageSize,Map map) {

		this.findfei(value, startPage, PageSize, map);
		return "be__billclear.html";

	}
	//水费清算的处理查看
	@RequestMapping(value = "queryshuiById/{id}", produces = {"application/json;charset=UTF-8"})
	public String findshuiOne(@PathVariable(name="id") String id,Map map,HttpSession session) {
		List<BeOrderuser> obj=  beOrderService.beuser(id);
		BeOrderuser user=obj.get(0);
		map.put("BeOrder", user);
        String o=user.getOrderNo();
        session.setAttribute("o", o);

		return "be__billclearForm.html";
	}
    @RequestMapping(value = "shui", produces = {"application/json;charset=UTF-8"})
    public String shui(BeOrder value, BeHistory beHistory,BeOrderuser beuser,Map map,HttpSession session) {
        value.setStepID(5);
        beHistory.setStepID(5);
        String orno = (String) session.getAttribute("o");
        String o1=value.getOrderNo();
        System.out.println(orno+"dd"+o1);
        beHistory.setOrderNo(o1);
        Date d = new Date();
        beHistory.setDatee(d.toInstant());
        beHistory.setEmpID(4);
        beOrderService.updateNotNullById(value);
        beHistoryService.saveNotNull(beHistory);

        System.out.println(value + " " + beHistory );
        return "redirect:/queryBeOrdergong";

    }

        //供水协议查看
	@RequestMapping(value = "queryBeOrdergong", produces = {"application/json;charset=UTF-8"})
	public String findgong(BeOrder value, @RequestParam(defaultValue ="1",required = false) int startPage ,
						   @RequestParam(defaultValue = "5",required = false) int PageSize,Map map) {

		this.findfei(value, startPage, PageSize, map);
		return "be__contract.html";

	}

	//供水协议的处理中的查看

	@RequestMapping(value = "gonglook/{value}", produces = {"application/json;charset=UTF-8"})
	public String gonglook(@PathVariable(name="value") String value, Map map,HttpSession session) {

		List<BeOrderuser> list=beOrderService.beuser(value);
			String orderno=list.get(0).getOrderNo();
            session.setAttribute("list", list);
		session.setAttribute("no1", orderno);
		map.put("list",list);
		return "be__contractForm.html";
	}
    @RequestMapping(value = "gongdeal", produces = {"application/json;charset=UTF-8"})
    public String gongdeal(BeOrder value, BeHistory beHistory,BeOrderuser beuser,Map map,BeFormula formula,HttpSession session,String num,String numno) {
        value.setStepID(6);
        beHistory.setStepID(6);
		String orno= (String) session.getAttribute("no1");
		System.out.println(orno+"kk");

        List<BeOrderuser> be= (List<BeOrderuser>) session.getAttribute("list");
			for (int i=0;i<be.size();i++){
				int userno= (int) be.get(i).getID();
				String num1=num.substring(4, 8);

				String num2=num.substring(12, 14);
				int n= Integer.parseInt(num2);

				formula.setAllotText(num1);
				formula.setAllotValue(n);

				formula.setAllotType(1);
				formula.setWaterTypeCode("生活用水");
				beFormulaService.saveNotNull(formula);
				//放合同号
				beuser.setContractNum(numno);
				beOrderuserService.updateNotNullById(beuser);

			}



        beHistory.setOrderNo(orno);
        Date d = new Date();
        beHistory.setDatee(d.toInstant());
        beHistory.setEmpID(5);

		beOrderService.updateNotNullById(value);
        beHistoryService.saveNotNull(beHistory);

        System.out.println(value + " " + beHistory );
        return "redirect:/queryBeOrdergong";

    }



    /**
	 * 插入BeOrder属性不为空的数据方法
	 * 
	 * @return
	 */
	//新户
	@RequestMapping(value = "saveBeOrder", produces = {"application/json;charset=UTF-8"})
    public String save(BeOrder value, BeOrderUserList users, Map map) {
		int no=1;
		String oldDate=beOrderService.findDate(no);
		map.put("no",oldDate );
		String i=oldDate.substring(12);
		int t=Integer.parseInt(i);
		int r=t+1;

		if(r>9){
			String o=oldDate.substring(0, 13)+r;
			value.setOrderNo(o);

			map.put("no", o);
		}else{
			String o=oldDate.substring(0, 14)+r;
			value.setOrderNo(o);

			map.put("no", o);
		}

		Calendar c=Calendar.getInstance();
		String date=c.get(Calendar.YEAR)+"年"+(c.get(Calendar.MONTH)+1)+"月"+c.get(Calendar.DATE)+"日";

		value.setOrderType(no);
		value.setStepID(1);


		value.setCreateDate(date);


		for(BeOrderuser d : users.getList()){


			value.setMeterCount(users.getList().size());
			if(r>9){
				String o=oldDate.substring(0, 13)+r;

				d.setOrderNo(o);

			}else{
				String o=oldDate.substring(0, 14)+r;

				d.setOrderNo(o);

			}
			beOrderuserService.saveNotNull(d);
		}
		beOrderService.saveNotNull(value);

		return "redirect:/queryBeOrder";
    }
    //分户
	@RequestMapping(value = "saveBeOrder1", produces = {"application/json;charset=UTF-8"})
	public String save1(BeOrder value, BeOrderUserList users,BeHistory beHistory, Map map) {
		int noq=2;
		String oldDate=beOrderService.findDate(noq);

		if(oldDate==null){
			Calendar c=Calendar.getInstance();
			oldDate="B2-"+ c.get(Calendar.YEAR)+(c.get(Calendar.MONTH)+1)+c.get(Calendar.DATE)+"0001";
			value.setOrderNo(oldDate);
			beHistory.setOrderNo(oldDate);
			map.put("no",oldDate );

		}else {
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;
			if (r > 9) {
				String o = oldDate.substring(0, 13) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			} else {
				String o = oldDate.substring(0, 14) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			}
		}
		Calendar c=Calendar.getInstance();
		String date=c.get(Calendar.YEAR)+"年"+(c.get(Calendar.MONTH)+1)+"月"+c.get(Calendar.DATE)+"日";

		value.setOrderType(noq);
		value.setStepID(1);


		value.setCreateDate(date);


		for(BeOrderuser d : users.getList()){
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;

			value.setMeterCount(users.getList().size());
			if(r>9){
				String o=oldDate.substring(0, 13)+r;

				d.setOrderNo(o);

			}else{
				String o=oldDate.substring(0, 14)+r;

				d.setOrderNo(o);

			}
			beOrderuserService.saveNotNull(d);
		}
		beOrderService.saveNotNull(value);


		beHistory.setStepID(1);
		beHistoryService.saveNotNull(beHistory);

		return "redirect:/queryBeOrder";
	}

	@RequestMapping(value = "saveBeOrderlan2", produces = {"application/json;charset=UTF-8"})
	public String save2(BeOrder value, BeOrderUserList users,BeHistory beHistory, Map map) {
		int noq=3;
		String oldDate=beOrderService.findDate(noq);

		if(oldDate==null){
			Calendar c=Calendar.getInstance();
			oldDate="B3-"+ c.get(Calendar.YEAR)+(c.get(Calendar.MONTH)+1)+c.get(Calendar.DATE)+"0001";
			value.setOrderNo(oldDate);
			beHistory.setOrderNo(oldDate);
			map.put("no",oldDate );

		}else {
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;
			if (r > 9) {
				String o = oldDate.substring(0, 13) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			} else {
				String o = oldDate.substring(0, 14) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			}
		}
		Calendar c=Calendar.getInstance();
		String date=c.get(Calendar.YEAR)+"年"+(c.get(Calendar.MONTH)+1)+"月"+c.get(Calendar.DATE)+"日";

		value.setOrderType(noq);
		value.setStepID(1);


		value.setCreateDate(date);


		for(BeOrderuser d : users.getList()){
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;

			value.setMeterCount(users.getList().size());
			if(r>9){
				String o=oldDate.substring(0, 13)+r;

				d.setOrderNo(o);

			}else{
				String o=oldDate.substring(0, 14)+r;

				d.setOrderNo(o);

			}
			beOrderuserService.saveNotNull(d);
		}
		beOrderService.saveNotNull(value);


		beHistory.setStepID(1);
		beHistoryService.saveNotNull(beHistory);

		return "redirect:/queryBeOrder";
	}
	//代扣
	@RequestMapping(value = "saveBeOrder3", produces = {"application/json;charset=UTF-8"})
	public String save3(BeOrder value, BeOrderUserList users,BeHistory beHistory, Map map) {
		int noq=4;
		String oldDate=beOrderService.findDate(noq);

		if(oldDate==null){
			Calendar c=Calendar.getInstance();
			oldDate="B4-"+ c.get(Calendar.YEAR)+(c.get(Calendar.MONTH)+1)+c.get(Calendar.DATE)+"0001";
			value.setOrderNo(oldDate);
			beHistory.setOrderNo(oldDate);
			map.put("no",oldDate );

		}else {
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;
			if (r > 9) {
				String o = oldDate.substring(0, 13) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			} else {
				String o = oldDate.substring(0, 14) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			}
		}
		Calendar c=Calendar.getInstance();
		String date=c.get(Calendar.YEAR)+"年"+(c.get(Calendar.MONTH)+1)+"月"+c.get(Calendar.DATE)+"日";

		value.setOrderType(noq);
		value.setStepID(1);


		value.setCreateDate(date);


		for(BeOrderuser d : users.getList()){
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;

			value.setMeterCount(users.getList().size());
			if(r>9){
				String o=oldDate.substring(0, 13)+r;

				d.setOrderNo(o);

			}else{
				String o=oldDate.substring(0, 14)+r;

				d.setOrderNo(o);

			}
			beOrderuserService.saveNotNull(d);
		}
		beOrderService.saveNotNull(value);


		beHistory.setStepID(1);
		beHistoryService.saveNotNull(beHistory);

		return "redirect:/queryBeOrder";
	}
	@RequestMapping(value = "saveBeOrder4", produces = {"application/json;charset=UTF-8"})
	public String save4(BeOrder value, BeOrderUserList users,BeHistory beHistory, Map map) {
		int noq=5;
		String oldDate=beOrderService.findDate(noq);

		if(oldDate==null){
			Calendar c=Calendar.getInstance();
			oldDate="B5-"+ c.get(Calendar.YEAR)+(c.get(Calendar.MONTH)+1)+c.get(Calendar.DATE)+"0001";
			value.setOrderNo(oldDate);
			beHistory.setOrderNo(oldDate);
			map.put("no",oldDate );

		}else {
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;
			if (r > 9) {
				String o = oldDate.substring(0, 13) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			} else {
				String o = oldDate.substring(0, 14) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			}
		}
		Calendar c=Calendar.getInstance();
		String date=c.get(Calendar.YEAR)+"年"+(c.get(Calendar.MONTH)+1)+"月"+c.get(Calendar.DATE)+"日";

		value.setOrderType(noq);
		value.setStepID(1);


		value.setCreateDate(date);


		for(BeOrderuser d : users.getList()){
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;

			value.setMeterCount(users.getList().size());
			if(r>9){
				String o=oldDate.substring(0, 13)+r;

				d.setOrderNo(o);

			}else{
				String o=oldDate.substring(0, 14)+r;

				d.setOrderNo(o);

			}
			beOrderuserService.saveNotNull(d);
		}
		beOrderService.saveNotNull(value);


		beHistory.setStepID(1);
		beHistoryService.saveNotNull(beHistory);

		return "redirect:/queryBeOrder";
	}
	@RequestMapping(value = "saveBeOrder5", produces = {"application/json;charset=UTF-8"})
	public String save5(BeOrder value, BeOrderUserList users,BeHistory beHistory, Map map) {
		int noq=6;
		String oldDate=beOrderService.findDate(noq);

		if(oldDate==null){
			Calendar c=Calendar.getInstance();
			oldDate="B6-"+ c.get(Calendar.YEAR)+(c.get(Calendar.MONTH)+1)+c.get(Calendar.DATE)+"0001";
			value.setOrderNo(oldDate);
			beHistory.setOrderNo(oldDate);
			map.put("no",oldDate );

		}else {
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;
			if (r > 9) {
				String o = oldDate.substring(0, 13) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			} else {
				String o = oldDate.substring(0, 14) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			}
		}
		Calendar c=Calendar.getInstance();
		String date=c.get(Calendar.YEAR)+"年"+(c.get(Calendar.MONTH)+1)+"月"+c.get(Calendar.DATE)+"日";

		value.setOrderType(noq);
		value.setStepID(1);


		value.setCreateDate(date);


		for(BeOrderuser d : users.getList()){
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;

			value.setMeterCount(users.getList().size());
			if(r>9){
				String o=oldDate.substring(0, 13)+r;

				d.setOrderNo(o);

			}else{
				String o=oldDate.substring(0, 14)+r;

				d.setOrderNo(o);

			}
			beOrderuserService.saveNotNull(d);
		}
		beOrderService.saveNotNull(value);


		beHistory.setStepID(1);
		beHistoryService.saveNotNull(beHistory);

		return "redirect:/queryBeOrder";
	}
	@RequestMapping(value = "saveBeOrder6", produces = {"application/json;charset=UTF-8"})
	public String save6(BeOrder value, BeOrderUserList users,BeHistory beHistory, Map map) {
		int noq=7;
		String oldDate=beOrderService.findDate(noq);

		if(oldDate==null){
			Calendar c=Calendar.getInstance();
			oldDate="B7-"+ c.get(Calendar.YEAR)+(c.get(Calendar.MONTH)+1)+c.get(Calendar.DATE)+"0001";
			value.setOrderNo(oldDate);
			beHistory.setOrderNo(oldDate);
			map.put("no",oldDate );

		}else {
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;
			if (r > 9) {
				String o = oldDate.substring(0, 13) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			} else {
				String o = oldDate.substring(0, 14) + r;
				value.setOrderNo(o);
				beHistory.setOrderNo(o);
				map.put("no", o);
			}
		}
		Calendar c=Calendar.getInstance();
		String date=c.get(Calendar.YEAR)+"年"+(c.get(Calendar.MONTH)+1)+"月"+c.get(Calendar.DATE)+"日";

		value.setOrderType(noq);
		value.setStepID(1);


		value.setCreateDate(date);


		for(BeOrderuser d : users.getList()){
			String i = oldDate.substring(12);
			int t = Integer.parseInt(i);
			int r = t + 1;

			value.setMeterCount(users.getList().size());
			if(r>9){
				String o=oldDate.substring(0, 13)+r;

				d.setOrderNo(o);

			}else{
				String o=oldDate.substring(0, 14)+r;

				d.setOrderNo(o);

			}
			beOrderuserService.saveNotNull(d);
		}
		beOrderService.saveNotNull(value);


		beHistory.setStepID(1);
		beHistoryService.saveNotNull(beHistory);

		return "redirect:/queryBeOrder";
	}
	//工单的查询页面
	@RequestMapping(value = "ao", produces = {"application/json;charset=UTF-8"})
	public String finddang(BeOrder value, @RequestParam(defaultValue ="1",required = false) int startPage ,
						   @RequestParam(defaultValue = "5",required = false) int PageSize,Map map) {

		this.findfei(value, startPage, PageSize, map);
		return "be__requestOrder.html";

	}
	//ajax
	@ResponseBody //不跳页面直接返回json对象
	@RequestMapping("findOld/{value}")
	public BeOrderuser find(@PathVariable(name="value")String value,Map map){
		BeOrderuser user=beOrderService.old(value);
		System.out.println(user+"  "+value);
		map.put("user", user);
		return  user;
	}

	//根据工单号展示流程历史及附加信息
    @RequestMapping(value = "mes/{value}", produces = {"application/json;charset=UTF-8"})
    public String mes(@PathVariable(name="value")String value,Map map,HttpSession session){
        List<Map> list=beOrderService.mes(value);

        String orderNo = (String) list.get(0).get("OrderNo");
        BeOrder order=beOrderService.findOne(orderNo);
        map.put("order", order);
        List<BeOrderuser> orus=beOrderService.beuser(orderNo);
        List<BeComment> comments=beOrderService.fmes(orderNo);



		map.put("json", JSON.toJSON(comments));
		map.put("comments", comments);
        map.put("orus", orus);

        session.setAttribute("commno", orderNo);
        map.put("list", list);
	    return "be_orderInfo.html";
    }

	//添加附加信息
    @ResponseBody
    @RequestMapping("addhis")
    public BeComment  his(BeComment his,Map map,HttpSession session){
        String orno= (String) session.getAttribute("commno");
	    his.setOrderNo(orno);
	    Date d=new Date();
	    his.setDatee(d);
     beOrderService.addcomment(his);
        return  his;
    }
    //修改
    @ResponseBody
    @RequestMapping(value = "upcomm", produces = {"application/json;charset=UTF-8"})
        public String upcomm(BeComment beComment,Map map,HttpSession session) {
        String orno= (String) session.getAttribute("commno");
        beComment.setEmpID(3);
      int i= beOrderService.upcomment(beComment);


        return 200+"";
    }

    //删除附加信息
    @ResponseBody
    @RequestMapping(value = "delcomm", produces = {"application/json;charset=UTF-8"})
    public List<BeComment> delete(BeComment beComment,HttpSession session,Map map) {
        String orno= (String) session.getAttribute("commno");
        beOrderService.decomm(beComment);
        List<BeComment>  comments=beOrderService.fmes(orno);



        map.put("json", JSON.toJSON(comments));
                return comments;
    }

    /**
	 * 更新BeOrder属性不为空的数据方法
	 * 
	 * @return
	 */
	@RequestMapping(value = "updateBeOrder", produces = {"application/json;charset=UTF-8"})

    public String update(BeOrder value) {
		  beOrderService.updateNotNullById(value);
          return "redirect:/queryBeOrder";
	}
	
	/**
	 * 通过id删除BeOrder数据方法
	 * 
	 * @return
	 */


}
